package com.hyperion.blog.controller;

import com.hyperion.blog.common.aop.LogAnnotation;
import com.hyperion.blog.service.SSOService;
import com.hyperion.blog.vo.result.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author Hyperion
 */
@RestController
@RequestMapping("/logout")
public class LogoutController {

    @Resource
    private SSOService SSOService;

    @GetMapping
    @LogAnnotation(clazz = "LogoutController", method = "logout")
    public Result logout(@RequestHeader("Authorization") String token) {
        SSOService.logout(token);
        return Result.success(null);
    }
}